import SwiftyJSON

struct HomeResult {
    var TotalProduct: String?
    var Product = [HomeProduct]()
    var Topic = [HomeTopic]()
    var Icon = [HomeIcon]()
    var Success: String?
    var Slide = [HomeSlide]()
    
    init(json: JSON) {
        TotalProduct = json["TotalProduct"].stringValue
        Product = json["Product"].arrayValue.flatMap({ HomeProduct(json: $0)})
        Topic = json["Topic"].arrayValue.flatMap({ HomeTopic(json: $0)})
        Icon = json["Icon"].arrayValue.flatMap({ HomeIcon(json: $0)})
        Success = json["Success"].stringValue
        Slide = json["Slide"].arrayValue.flatMap({ HomeSlide(json: $0)})
    }
}

struct HomeCashDepositsServer {
    var IsSevenDayNoReasonReturn: Bool = false
    var IsCustomerSecurity: Bool = false
    var IsTimelyShip: Bool = false
    var CanSelfTake: Bool = false
    
    init(json: JSON) {
        IsSevenDayNoReasonReturn = json["IsSevenDayNoReasonReturn"].boolValue
        IsCustomerSecurity = json["IsCustomerSecurity"].boolValue
        IsTimelyShip = json["IsTimelyShip"].boolValue
        CanSelfTake = json["CanSelfTake"].boolValue
    }
}

struct HomeProduct {
    var CommentsCount: String?
    var ProductAttributeInfos = [String]()
    var ShopName: String?
    var Discount: String?
    var VshopId: String?
    var MarketPrice: String?
    var Url: String?
    var SalePrice: String?
    var Id: String?
    var CashDepositsServer: HomeCashDepositsServer?
    var Name: String?
    var Address: String?
    var ImageUrl: String?
    
    init(json: JSON) {
        CommentsCount = json["CommentsCount"].stringValue
        ProductAttributeInfos = json["ProductAttributeInfos"].arrayValue.flatMap({$0.stringValue})
        ShopName = json["ShopName"].stringValue
        Discount = json["Discount"].stringValue
        VshopId = json["VshopId"].stringValue
        MarketPrice = json["MarketPrice"].stringValue
        Url = json["Url"].stringValue
        SalePrice = json["SalePrice"].stringValue
        Id = json["Id"].stringValue
        CashDepositsServer = HomeCashDepositsServer(json: json["CashDepositsServer"])
        Name = json["Name"].stringValue
        Address = json["Address"].stringValue
        ImageUrl = json["ImageUrl"].stringValue
    }
}

struct HomeTopic {
    var Url: String?
    var ImageUrl: String?
    
    init(json: JSON) {
        Url = json["Url"].stringValue
        ImageUrl = json["ImageUrl"].stringValue
    }
}

struct HomeIcon {
    var Desc: String?
    var Url: String?
    var ImageUrl: String?
    
    init(json: JSON) {
        Desc = json["Desc"].stringValue
        Url = json["Url"].stringValue
        ImageUrl = json["ImageUrl"].stringValue
    }
}

struct HomeSlide {
    var Desc: String?
    var Url: String?
    var ImageUrl: String?
    
    init(json: JSON) {
        Desc = json["Desc"].stringValue
        Url = json["Url"].stringValue
        ImageUrl = json["ImageUrl"].stringValue
    }
}
